<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="vue.js">
    </script>
    <link href="bootstrap.css" rel="stylesheet">
</head>
<body>
<div id="app1" class="">
    <div class="form-group">
        <label for="msg">{{reversedMessage}} -|- {{ now }}</label>
    </div>
    <div class="form-group">
        <label for="msg">{{msg}}</label>
        <input v-model="msg" type="text" class="form-control" id="msg" placeholder="input...">
    </div>
    <div class="form-group">
        <label for="msg">{{ fullName }} || {{ full }}</label>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
    var app1 = new Vue({
        el: "#app1",
        data: {
            msg: "today is children day",
            firstName: 'Foo',
            lastName: 'Bar',
            fullName: 'Foo Bar'
        },
        computed: {
            // a computed getter
            reversedMessage: function () {
                // `this` points to the vm instance
                return this.msg.split('').reverse().join('');
            },
            now: function () {
                return Date.now()
            },
            full: function () {
                return this.firstName + ' ' + this.lastName;
            }
        },
        watch: {
            firstName: function (val) {
                this.fullName = val + ' ' + this.lastName
            },
            lastName: function (val) {
                this.fullName = this.firstName + ' ' + val
            }
        }
    });
    console.log(app1.reversedMessage);
    app1.msg = 'haha';
    console.log(app1.reversedMessage);


</script>